package com.magic.gre.layoutmanager;

import android.support.annotation.NonNull;
import android.support.v4.view.ViewPager;
import android.view.View;

import com.noname.lib_base_java.util.L;

/**
 * Author: Lmoumou
 * Date: 2019-01-07 17:33
 * 文件名: UltraScaleTransformer
 * 描述:
 */
public class UltraScaleTransformer implements ViewPager.PageTransformer {
    private static final float MIN_SCALE = 0.85f;
    @Override
    public void transformPage(@NonNull View page, float position) {
        L.e("LLSSQQ","position->"+position);
        int pageWidth=page.getWidth();
        Float scaleFactor=MIN_SCALE + (1 - MIN_SCALE) * (1 - Math.abs(position));
        if (position<0){
            page.setScaleX(scaleFactor);
            page.setScaleY(scaleFactor);
        }else if (position==0F){
            page.setScaleX(1f);
            page.setScaleY(1f);
        }else if (position<=1){
            page.setScaleX(scaleFactor);
            page.setScaleY(scaleFactor);
        }
    }
}
